package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展会
 * </p>
 *
 * @author linan
 * @date 2023-03-22
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionStateEnum", description = "展会状态 #{STATE_ONE:无状态;STATE_TWO:销售商机;STATE_THREE:报价确认;STATE_FOUR:活动确认;STATE_FIVE:创立合同;STATE_SIX:合同付款;STATE_SEVEN:活动结算;STATE_EIGHT:活动结束;STATE_NINE:其他状态-枚举")
public enum ExhibitionStateEnum implements BaseEnum {

    /**
     * STATE_ONE="无状态"
     */
    STATE_ONE("无状态"),
    /**
     * STATE_TWO="销售商机"
     */
    STATE_TWO("销售商机"),
    /**
     * STATE_THREE="报价确认"
     */
    STATE_THREE("报价确认"),
    /**
     * STATE_FOUR="活动确认"
     */
    STATE_FOUR("活动确认"),
    /**
     * STATE_FIVE="创立合同"
     */
    STATE_FIVE("创立合同"),
    /**
     * STATE_SIX="合同付款"
     */
    STATE_SIX("合同付款"),
    /**
     * STATE_SEVEN="活动结算"
     */
    STATE_SEVEN("活动结算"),
    /**
     * STATE_EIGHT="活动结束"
     */
    STATE_EIGHT("活动结束"),
    /**
     * STATE_NINE="其他状态"
     */
    STATE_NINE("其他状态"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionStateEnum match(String val, ExhibitionStateEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionStateEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionStateEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "STATE_ONE,STATE_TWO,STATE_THREE,STATE_FOUR,STATE_FIVE,STATE_SIX,STATE_SEVEN,STATE_EIGHT,STATE_NINE", example = "STATE_ONE")
    public String getCode() {
        return this.name();
    }

}
